<?php

namespace Admin\Controller;

class MillingOrderController extends AdminbaseController {

    function _initialize() {
        parent::_initialize();
        $this->currentModel = D("MillingOrder");
    }

    //首页
    public function index() {

        $requestMap = $this->convertRequestToMap();
//        if($requestMap["o#status"] == -2){
//            unset($requestMap["o#status"]);
////            $requestMap["o#status-neq"] = array(1,2);
//            $requestMap["cp#used"] = 0;
//        }

        $users_obj= M("admin");
        $userId=$_SESSION['ADMIN_ID'];
        $user=$users_obj->where("user_id=$userId")->find();
//        $requestMap["fo.enterprise_code"] = $user["enterprise_code"];
        $this->assign("begin_time", $_REQUEST["o#create_time-egt"]);
        $this->assign("end_time", $_REQUEST["o#create_time-elt"]);

        //分页
        $count = $this->currentModel->getListCount($requestMap);
        $page = $this->page($count, C("DEFAULT_PAGE_SIZE"));

        $orderList = $this->currentModel->queryForList($page, $requestMap);

        $this->assign("user", $user);
        $this->assign("defaultEnum", C("INVOICE_TYPE"));
        $this->assign("statusEnum", C("GROUP_ORDER_STATUS"));
        $this->assign('orderList', $orderList);
        $this->assign("page", $page->show('Admin', $this->parameter));
        $this->display();

    }
}